package com.glela.order.model;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;

/**
* @ClassName: GatewayPaymentModel 
* @Description: 网关支付接口入库
* @author NingChongQing
* @date 2017年8月30日 下午3:07:39
 */
public class GatewayPaymentModel {
	private String app_key = "";// 分配给应用的AppKey
	private String format = "";// 响应格式
	private String session = "";// 	授权信息
	private String sign = "";// API输入参数签名结果
	private String sign_method = "";// 签名的摘要算法，可选值为：hmac，md5
	private String timestamp = "";// 时间戳，格式为yyyy-MM-dd HH:mm:ss，时区为GMT+8，例如：2015-01-01
	private String v = "";// API协议版本
	private String method = "";// API接口名称
	private double amount;// 支付金额
	private String payproducttype = "";// 支付产品类型 SALES:网银支付；ONEKEY:手机一键支付；WECHATU:用户扫码；WECHATG:公众号支付；WECHATAPP:微信app支付；ALIPAYAPP:支付宝app支付
	private int assure = 0;// 是否需要担保 0否，1是
	private String callbackurl = "";// 支付成功回调Server地址
	private String webcallbackurl = "";// 支付成功回调Web地址
	private String ip = "";// 	用户IP地址 IPv4
	private String productname = "";// 商品名称
	private String productdesc = "";// 商品描述
	private int orderexpdate;// 订单有效期
	private String requestid = "";// 交易单号
	private String userno = "";// 用户标识   商户用来表示用户的唯一标识|公众号用户openId
	private String appid = "";// 微信公众号APPID
	private String openid = "";// 微信公众号用户openId
	private String bussinessid=StringUtils.EMPTY;//业务单据ID
	
	private final static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	
	
	/**
	 * WAP-ZHT:手机端一键支付 
	 * WAP_WECHATAPP:WAP钱包 支付-WX 
	 * WAP_ALIPAYAPP:WAP钱包支 付-ZFB 
	 * WAP_WECHATG:WAP公众号 支付(收银台)
	 */
	private String directcode;
	
	
	public String getDirectcode() {
		return directcode;
	}

	public void setDirectcode(String directcode) {
		this.directcode = directcode;
	}

	/**
	* **********************************************
	* @Title: convertToMap 
	* @Description: GatewayPaymentModel转化为MAP，封装安全校验信息 
	* @param @return 
	* @return Map<String,Object>
	* @throws	
	* @author NingChongQing	
	* @date 2017年8月30日 下午5:05:55 
	* **********************************************
	 */
	public Map<String,Object> convertToMap(){
		Map<String,Object> map = new HashMap<String, Object>();
		map.put("app_key", this.getApp_key());
		map.put("format", "json");
		map.put("session", this.getSession());
		map.put("sign", this.getSign());
		map.put("sign_method", this.getSign_method());
		map.put("timestamp", sdf.format(new Date()));
		map.put("v", this.getV());
		map.put("method", "yeepay.trade.pay");
		map.put("payproducttype", this.getPayproducttype());
		map.put("amount", this.getAmount());
		map.put("assure", this.getAssure());
		map.put("callbackurl", this.getCallbackurl());
		map.put("webcallbackurl", this.getWebcallbackurl());
		map.put("productdesc", this.getProductdesc());
		map.put("productname", this.getProductname());
		map.put("ip", this.getIp());
		map.put("orderexpdate", this.getOrderexpdate());
		map.put("requestid", this.getRequestid());
		map.put("userno", this.getUserno());
		map.put("appid", this.getAppid());
		map.put("openid", this.getOpenid());
		map.put("bussinessid", this.getBussinessid());
		map.put("directcode", this.getDirectcode());
		return map;
	}

	public String getApp_key() {
		return app_key;
	}

	public void setApp_key(String app_key) {
		this.app_key = app_key;
	}

	public String getFormat() {
		return format;
	}

	public void setFormat(String format) {
		this.format = format;
	}

	public String getSession() {
		return session;
	}

	public void setSession(String session) {
		this.session = session;
	}

	public String getSign() {
		return sign;
	}

	public void setSign(String sign) {
		this.sign = sign;
	}

	public String getSign_method() {
		return sign_method;
	}

	public void setSign_method(String sign_method) {
		this.sign_method = sign_method;
	}

	public String getTimestamp() {
		return timestamp;
	}

	public void setTimestamp(String timestamp) {
		this.timestamp = timestamp;
	}

	public String getV() {
		return v;
	}

	public void setV(String v) {
		this.v = v;
	}

	public String getMethod() {
		return method;
	}

	public void setMethod(String method) {
		this.method = method;
	}
	
	public double getAmount() {
		return amount;
	}
	
	public void setAmount(double amount) {
		this.amount = amount;
	}
	
	public String getPayproducttype() {
		return payproducttype;
	}

	public void setPayproducttype(String payproducttype) {
		this.payproducttype = payproducttype;
	}

	public int getAssure() {
		return assure;
	}

	public void setAssure(int assure) {
		this.assure = assure;
	}

	public String getCallbackurl() {
		return callbackurl;
	}

	public void setCallbackurl(String callbackurl) {
		this.callbackurl = callbackurl;
	}

	public String getWebcallbackurl() {
		return webcallbackurl;
	}

	public void setWebcallbackurl(String webcallbackurl) {
		this.webcallbackurl = webcallbackurl;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public String getProductname() {
		return productname;
	}

	public void setProductname(String productname) {
		this.productname = productname;
	}

	public String getProductdesc() {
		return productdesc;
	}

	public void setProductdesc(String productdesc) {
		this.productdesc = productdesc;
	}

	public int getOrderexpdate() {
		return orderexpdate;
	}

	public void setOrderexpdate(int orderexpdate) {
		this.orderexpdate = orderexpdate;
	}

	public String getRequestid() {
		return requestid;
	}

	public void setRequestid(String requestid) {
		this.requestid = requestid;
	}

	public String getUserno() {
		return userno;
	}

	public void setUserno(String userno) {
		this.userno = userno;
	}

	public String getAppid() {
		return appid;
	}

	public void setAppid(String appid) {
		this.appid = appid;
	}

	public String getOpenid() {
		return openid;
	}

	public void setOpenid(String openid) {
		this.openid = openid;
	}

	public String getBussinessid() {
		return bussinessid;
	}

	public void setBussinessid(String bussinessid) {
		this.bussinessid = bussinessid;
	}
	
}
